#ifndef CVRENDERLIST_H_INCLUDED
#define CVRENDERLIST_H_INCLUDED

/**
 *	This header defines the cvRenderInterface::renderlist_t type
 *	and function objects.
 */
//predecl

//includes
#include "DrawlistNode.h"
#include <boost/intrusive/list.hpp>

namespace cvRenderInterface
{

	/// Rendering list type.
	typedef boost::intrusive::list<DrawlistNode,
			boost::intrusive::member_hook<DrawlistNode, boost::intrusive::list_member_hook<>, &DrawlistNode::m_renderlisthook>
									> renderinglist_t;
	/// iterator types for god sake..
	typedef renderinglist_t::iterator	renderinglist_it_t;
	typedef renderinglist_t::const_iterator	renderinglist_cit_t;
	typedef renderinglist_t::reverse_iterator renderinglist_rit_t;
	typedef renderinglist_t::const_reverse_iterator renderinglist_rcit_t;

	// element disposer: calls destroy()
	struct renderinglist_element_disposer
	{
		void operator() (DrawlistNode * element);
	};

	// element disposer: inserts the disposed elements into another list.
	class renderinglist_element_mover
	{
		public:
			// insert before given iterator.
			renderinglist_element_mover(renderinglist_t & list, renderinglist_it_t & it);
			// insert to end of the list.
			renderinglist_element_mover(renderinglist_t & list);

			void operator() (DrawlistNode * element);
		private:
			renderinglist_t & m_list;
			renderinglist_it_t m_it;
	};

};
#endif // CVRENDERLIST_H_INCLUDED
